package com.zrrd.linestructure;

public class Reverse {
    public void Reverse(int[] array) {
        int temp;
        for (int i = 0, j = array.length - 1; i < j; i++, j--) {
            temp = array[i];
            array[i] = array[j];
            array[j] = temp;
        }
    }


    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4, 5,};
        Reverse reverse = new Reverse();
        reverse.Reverse(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.printf(String.valueOf(arr[i]));
        }
    }
}
